﻿@using Web.Infrastructure.JSExtensions
@model BLL.Services.Books.Listing.BooksListing
@{
    Layout = null;
}
<a class="close" href="@Url.Action(MVC.Admin.Content.Dashboard())"></a>
<form class="filters" action="#">
    <fieldset>
        <legend>Search:</legend>
        @Html.EditorFor(x => x.Filter)
        <div class="buttons">
            <button class="search" type="button">Search</button>
            <button class="reset" type="reset">Clear</button>
        </div>
    </fieldset>
</form>
<form method="post" class="listing" action="" >
    @(Html.GridFor(x => x.Books)
          .TableCssClass("grid")
          .Identity(x => x.BookId)
          .Attribute("data-img", x => x.ImageUrl)
          .Column(x => x.Name)
          .Column(x => x.Authors, "<% _.each(item.Authors, function(author) { %><p><%= author %></p><% });%>")
          .Column(x => x.Categories, "<% _.each(item.Categories, function(category) { %><p><%= category %></p><% });%>")
          .Column(x => x.DateOfPublish)
          .EditEntityAction(MVC.Admin.Books.Edit())
          .NoItemsText("There are no books.")
          .PaginatorAction(MVC.Admin.Books.Listing())
          .Render()
          )
    <div class="buttons">
        <button type="button" class="create">Create</button>
        <button type="button" class="delete">Delete</button>
    </div>
</form>

<img id="BookCover" />